package com.qf.zwy.office.conteroller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qf.office.common.base.result.ResponseResult;
import com.qf.zwy.office.common.qo.CourseQo;
import com.qf.zwy.office.common.vo.CourseVo;
import com.qf.zwy.office.service.CourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 子未语
 */
@RestController
@Api(tags = "课程接口")
@RequestMapping("/course")
public class CourseController {

    @Resource
    private CourseService courseService;

    @PostMapping("/list")
    @ApiOperation("分页查询")
    @ApiImplicitParams({@ApiImplicitParam(name = "courseQo", value = "查询条件"),
            @ApiImplicitParam(name = "size", value = "页数"),
            @ApiImplicitParam(name = "page", value = "大小")
    })
    public ResponseResult<IPage<CourseVo>> selectAll(@RequestBody CourseQo courseQo,
                                                     @RequestParam(defaultValue = "1") Integer size,
                                                     @RequestParam(defaultValue = "3") Integer page) {
        return ResponseResult.success(courseService.selectAll(courseQo, size, page));
    }


    @PostMapping("/add")
    public ResponseResult<Integer> add() {
        return ResponseResult.success(null);
    }
}
